<template>
  <router-view />
  <Login />
</template>

<script>
import Login from "@/components/login.vue";
import { onMounted, onUnmounted, reactive, ref, toRefs } from "vue";
import { useRoute, useRouter } from "vue-router";
import * as LoginApi from "@/api/login";
import { storeUser } from "@/store/user";
export default {
  components: {
    Login,
  },
  setup(props, ctx) {
    const userStore = storeUser();
    onMounted(async () => {
      let token = localStorage.getItem("token");
      if (token) {
        let { data } = await LoginApi.getUserInfo({ UserToken: token });
        if (data.Status == 0) {
          userStore.setUser(data.UserData);
        }else{
          // userStore.setUser({});
          userStore.clearUser()
        }
      }
    });
    return {};
  },
};
</script>
<style>
  *{
    user-select:none !important;
  }
</style>
